package gene.android.accountingpro.equations;

import gene.android.accountingpro.finals.EquationNames;
import gene.android.accountingpro.finals.FieldList;

import java.util.ArrayList;
import java.util.List;

import android.util.Log;

public class DebtToTotalAssetsRatio extends Equation {
	
	
	private double totalDebt;
	private double totalAssets;

	public DebtToTotalAssetsRatio(){}
	
	public DebtToTotalAssetsRatio( double totalDebt, double totalAssets ){
		this.totalDebt = totalDebt;
		this.totalAssets = totalAssets;
		value = ( totalDebt / totalAssets );
	}
	
	@Override
	public String getEquationName() {
		return EquationNames.DEBT_TO_TOTAL_ASSETS_RATIO;
	}

	@Override
	public List<String> getRequiredFields()
	{
		List<String> requiredFields = new ArrayList<String>();
		requiredFields.add( FieldList.TOTAL_DEBT );
		requiredFields.add( FieldList.TOTAL_ASSETS );
		return requiredFields;
	}

	@Override
	public void setValues(double[] values) {
		totalDebt = values[0];
		totalAssets = values[1];
		solve();
	}

	@Override
	public String getSolvedEquationString() {
		return "( " + totalDebt +" / " + totalAssets +" ) = " + value;
	}

	@Override
	public void solve() {
		
		value = ( totalDebt / totalAssets );
	}

	@Override
	public String getEquationString() {
		return "( " + FieldList.TOTAL_DEBT+" / " + FieldList.TOTAL_ASSETS +" )";
	}

}
